<?php
function V_SanphamSearch(&$arrayDataCat,$arayDataHangsx,$action,$action2){
	$ulr = "?".MODUL."=sanpham&".ACTION."=List&".ACTION2."=";//htmlspecialchars($_SERVER['QUERY_STRING']);
	$id_loai_sp = $_GET['id_loai'];
	$$id_hang = $_GET['id_hang'];
	?>
	<script>
	function CheckValue(){
		var form = document.frmSearchText ;
		if(form.tensp.value == ""){
			alert("Mời bạn nhập vào Tên của sản phẩm cần tìm kiếm");
			form.tensp.focus();
			return false;
		}	
		return true;
	}
	</script>
	
	<?= CM_showMessage(); ?>
	<?= CM_showError(); ?>
	<table width="100%" height="200%" border="0" cellpadding="3"cellspacing="0" bordercolor="#FF9900" bordercolordark="white">
		<form action="<?=$ulr?>SearchProductResult" method="post" name="frmSearchText" id="frmSearchText"  onSubmit="return CheckValue()">
		<input type="hidden" name="modul" value="<?=CM_getParameter("modul")?>" /> 
		<input type="hidden" name="action" value="<?=CM_getParameter("action")?>" /> 
		<input type="hidden" name="ACTION2" value="<?=CM_getParameter("ACTION2")?>" /> 
	  <tr>
		<td width="324"></td>
	  </tr>
	  <tr>
		<td align="left" valign="top" background="" class="left-menu-aki">
		<table width="97%" border="1" align="center" cellpadding="3"cellspacing="0" bordercolor="#FF9900" bordercolordark="white">
			<tr class=bk12-140 bgcolor="#FFE59F">
			  <td colspan="3" align="left" ><div align="center"><strong>Tìm Kiếm Sản phẩm</strong></div></td>
		  </tr>
		  	<tr>
			  <td width="231" align="left" bgcolor="#FFE59F" class=bk12-140 ><font color="#000066">Tên sản phẩm</font></td>
			  <td width="936" colspan="2" align="left"><input name="tensp" type="text" class="form200" style="WIDTH: 195px" /></td>
		    </tr>
			<tr>
			  <td align="left" bgcolor="#FFE59F" class=bk12-140 ><font color="#000066">Loại sản phẩm</font> </td>
			  <td colspan="2" align="left">
			  	<select name="id_loai_sp" style="WIDTH: 200px">
					<option value="0"  selected>Chọn loại tất cả</option>
			  		<?
					if(!empty($arrayDataCat)){
						foreach($arrayDataCat as $rowCat){
							$idCat=$rowCat["id"];
							$nameCat=$rowCat["ten_loai_sp"];
							if($idCat==$id_loai_sp){
								echo"<option value=$idCat  selected>$nameCat</option>";
							}else{
								echo"<option value=$idCat >$nameCat</option>";
							}
						}//end foreach
					}//end if
					?>
				</select>
			  </td>
		  </tr>
			
			<tr>
			  <td align="left" bgcolor="#FFE59F" class=bk12-140 ><font color="#000066">Hãng sản xuất</font></td>
			  <td colspan="2" align="left">
			  	<SELECT name="id_hang" id="hangsx" style="WIDTH: 200px">
					<option value="0"  selected>Chọn loại tất cả</option>
			  		<?
					if(!empty($arayDataHangsx)){
						foreach($arayDataHangsx as $rowHangsx){
							$idHangsx=$rowHangsx["id"];
							$nameHangsx=$rowHangsx["ten_hang"];
							if($idHangsx==$id_hang){
								echo"<option value=$idHangsx  selected>$nameHangsx</option>";
							}else{
								echo"<option value=$idHangsx >$nameHangsx</option>";
							}
						}//end foreach
					}//end if
					?>
				</SELECT>
			  </td>
		  </tr>
			
			<tr>
			  <td align="left">&nbsp;</td>
			  <td ><span class="bk12-140">
			      <input type="submit" name="Submit" value="     Tìm kiếm   "/>
		        <input name="nhaplai" type="reset" id="re" value=" Nhập lại   " />
		      </span></td>
			</tr>
		  </table></td>
	  </tr>
	  <tr>
		<td width="324" style="height:30px; ">&nbsp;</td>
	  </tr>
	  <tr>
	  	<td>
			<div id="searchdiv"></div>
		</td>
	  </tr>
	  </form>
	</table>
	
	<?php
}
?>

	